package com.crape.common.model;

import com.crape.common.utils.LabelUtils;
import com.crape.common.utils.StringUtil;

/**
 * 用户问题类
 * 
 * @author ChenKai 2012-11-4 下午12:09:32
 */
public class Question {

	private Long id; // ID
	private Long accountid; // 用户ID
	private Integer status; // 状态：0=待发布，1=发布，2=关闭，-1=删除
	private String question; // 问题
	private String complement; // 补充说明
	private String label; // 标签
	private Long answers; // 回答次数
	private Long attentions; // 关注数
	private String publishdate; // 发布时间
	private String createdate; // 创建时间
	private String modifydate; // 修改时间

	// ======================================
	private String[] labels; // 标签
	private Integer[] shareMethod; // 分享方式
	private AccountInfo accountInfo;
	private Answer answer;// 答案
	private String shortDes;
	private Integer isMe; // 状态：0=NO，1=YES

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getAccountid() {
		return accountid;
	}

	public void setAccountid(Long accountid) {
		this.accountid = accountid;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getQuestion() {
		return question;
	}

	public void setQuestion(String question) {
		this.question = question;
	}

	public String getComplement() {
		return complement;
	}

	public void setComplement(String complement) {
		this.complement = complement;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public Long getAnswers() {
		return answers;
	}

	public void setAnswers(Long answers) {
		this.answers = answers;
	}

	public Long getAttentions() {
		return attentions;
	}

	public void setAttentions(Long attentions) {
		this.attentions = attentions;
	}

	public String getPublishdate() {
		return StringUtil.getTimeStr(publishdate);
	}

	public void setPublishdate(String publishdate) {
		this.publishdate = publishdate;
	}

	public String getCreatedate() {
		return createdate;
	}

	public void setCreatedate(String createdate) {
		this.createdate = createdate;
	}

	public String getModifydate() {
		return StringUtil.getTimeStr(modifydate);
	}

	public void setModifydate(String modifydate) {
		this.modifydate = modifydate;
	}

	public String[] getLabels() {
		if (label != null) {
			return LabelUtils.getLabels(label, " ");
		}
		return labels;
	}

	public void setLabels(String[] labels) {
		this.labels = labels;
	}

	public Integer[] getShareMethod() {
		return shareMethod;
	}

	public void setShareMethod(Integer[] shareMethod) {
		this.shareMethod = shareMethod;
	}

	public AccountInfo getAccountInfo() {
		return accountInfo;
	}

	public void setAccountInfo(AccountInfo accountInfo) {
		this.accountInfo = accountInfo;
	}

	public Answer getAnswer() {
		return answer;
	}

	public void setAnswer(Answer answer) {
		this.answer = answer;
	}

	public String getShortDes() {
		if(complement!=null&&complement.length()>300){
			shortDes = complement.substring(0, 300)+"...";
		}else{
			shortDes = complement;
		}
		return shortDes;
	}

	public void setShortDes(String shortDes) {
		this.shortDes = shortDes;
	}

	public Integer getIsMe() {
		return isMe;
	}

	public void setIsMe(Integer isMe) {
		this.isMe = isMe;
	}
	
}
